﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HCSAnalyzer.Classes.Base_Classes.DataStructures;
using HCSAnalyzer.Classes._3D;
using LibPlateAnalysis;
using System.Drawing;
using Kitware.VTK;

namespace HCSAnalyzer.Classes.Base_Classes.Viewers._3D.ComplexObjects
{
    class c3DObject_Axis : cComponent
    {
        //public double Radius = 3;
        //public bool IsLinked = false;
        //public bool DrawAxis = true;
        //public int ValueToBeDisplayed = -1;
        //public int ValueForSphereRadius = -1;
        //public cGlobalInfo GlobalInfo = null;

        cListGeometric3DObject ListObjects = null;
        cExtendedTable Input;


        public c3DObject_Axis()
        {
            Title = "3D complex objects: Axis";
            //this.GlobalInfo = GlobalInfo;
        }


        public void SetInputData(cExtendedTable Input)
        {
            this.Input = Input;
        }

        public cFeedBackMessage Run(c3DNewWorld _3DWorld)
        {
           
            //if(_3DWorld==null)
            //{
            //    FeedBackMessage.IsSucceed = false;
            //    FeedBackMessage.Message = "3D world not defined, operation aborded.";
            //    return FeedBackMessage;
            //}

            if (this.Input == null)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No input data table defined.";
                return FeedBackMessage;
            }

            this.ListObjects = new cListGeometric3DObject();

            c3DArrow XAxis = new c3DArrow(new cPoint3D(0, 0, 0), new cPoint3D(1, 0, 0));
            XAxis.Tag = this.Input[0].Tag;
            XAxis.Scale = this.Input[0][1];
            this.ListObjects.AddObject(XAxis);

            c3DArrow YAxis = new c3DArrow(new cPoint3D(0, 0, 0), new cPoint3D(0, 1, 0));
            YAxis.Tag = this.Input[1].Tag;
            YAxis.Scale = this.Input[1][1];
            this.ListObjects.AddObject(YAxis);

            c3DArrow ZAxis = new c3DArrow(new cPoint3D(0, 0, 0), new cPoint3D(0, 0,1 ));
            ZAxis.Tag = this.Input[2].Tag;
            ZAxis.Scale = this.Input[2][1];
            this.ListObjects.AddObject(ZAxis);

            c3DText TmpText = new c3DText(_3DWorld, this.Input[0].Name, new cPoint3D(0.45, -0.04, -0.04), Color.White, 0.02);
            TmpText.Tag = this.Input[0].Tag;
            this.ListObjects.AddObject(TmpText);
            this.ListObjects.AddObject(new c3DText(_3DWorld, this.Input[0][1].ToString("N3"), new cPoint3D(0.92, 0.03, -0.03), Color.DimGray, 0.01));
            this.ListObjects.AddObject(new c3DText(_3DWorld, this.Input[0][0].ToString("N3"), new cPoint3D(0.02, 0.03, -0.03), Color.DimGray, 0.01));

            TmpText = new c3DText(_3DWorld, this.Input[1].Name, new cPoint3D(-0.04, 0.45, -0.04), Color.White, 0.02);
            TmpText.Tag = this.Input[1].Tag;
            this.ListObjects.AddObject(TmpText);
            this.ListObjects.AddObject(new c3DText(_3DWorld, this.Input[1][1].ToString("N3"), new cPoint3D(-0.03, 0.92, -0.03), Color.DimGray, 0.01));
            this.ListObjects.AddObject(new c3DText(_3DWorld, this.Input[1][0].ToString("N3"), new cPoint3D(-0.03, -0.02, 0.03), Color.DimGray, 0.01));

            TmpText = new c3DText(_3DWorld, this.Input[2].Name, new cPoint3D(-0.04, -0.04, 0.45), Color.White, 0.02);
            TmpText.Tag = this.Input[2].Tag;
            this.ListObjects.AddObject(TmpText);
            this.ListObjects.AddObject(new c3DText(_3DWorld, this.Input[2][1].ToString("N3"), new cPoint3D(-0.03, -0.03, 0.92), Color.DimGray, 0.01));
            this.ListObjects.AddObject(new c3DText(_3DWorld, this.Input[2][0].ToString("N3"), new cPoint3D(0.03, -0.03, -0.02), Color.DimGray, 0.01));


            return base.FeedBackMessage;
        }

        public cListGeometric3DObject GetOutPut()
        {
            return this.ListObjects;
        }

    }
}
